import {  getQuestions, addAnswersContent, updateAnswersContent,getCommitDetails } from '@/services/work';

export default {
    namespace: 'work',

    state: {

    },

    effects: {
        *questions({ payload,callback }, { call }) {
            const response = yield call(getQuestions, payload);
            console.log(response);
            if (callback) callback(response);
        },
        *getCommit({ payload,callback }, { call }) {
            const response = yield call(getCommitDetails, payload);
            console.log(response);
            if (callback) callback(response);
        },
        *add({ payload, callback }, { call, put }) {
            const response = yield call(addAnswersContent, payload);
            console.log(response);
            if (callback) callback(response);
        },
        *update({ payload, callback }, { call, put }) {
            const response = yield call(updateAnswersContent, payload);
            console.log(response);
            if (callback) callback(response);
        }
    },

    reducers: {
        save(state, action) {
            return {
                ...state,
                taskData: action.payload,
            };
        },
    },
};
